package com.test.deencredit.config_deencredit;

import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;

import androidx.core.content.ContextCompat;

public class PermissionConfig_deencredit {

    public static final int PermissionCode_All_deencredit = 608;
    public static final int PermissionCode_Camera_deencredit = 64;
    public static final int PermissionCode_PhoneState_deencredit = 19;
    public static final int PermissionCode_Sms_deencredit = 642;
    public static final int PermissionCode_Home_deencredit = 274;


    public static final String[] Permissions_All_deencredit = new String[]{"android.permission.CAMERA","android.permission.READ_PHONE_STATE","android.permission.READ_SMS"};
    public static final String[] Permissions_Start_deencredit = new String[]{"android.permission.READ_PHONE_STATE","android.permission.READ_SMS"};

    public static final String Permission_Camera_deencredit = "android.permission.CAMERA";
    public static final String Permission_Phonestate_deencredit = "android.permission.READ_PHONE_STATE";
    public static final String Permission_Sms_deencredit = "android.permission.READ_SMS";

    public static boolean checkAllPermission_deencredit(Activity activity){
        for (String permission: Permissions_All_deencredit){
            if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(activity,permission)) return false;
        }
        return true;
    }

    public static boolean checkStartPermission_deencredit(Activity activity){
        for (String permission: Permissions_Start_deencredit){
            if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(activity,permission)) return false;
        }
        return true;
    }

    public static boolean checkPermissions_deencredit(Context context, String... permissions){
        for (String permission:permissions){
            if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(context,permission)) return false;
        }
        return true;
    }

    public static boolean checkCameraPermission_deencredit(Activity activity){
        return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, Permission_Camera_deencredit);
    }

    public static boolean checkPhonestatePermission_deencredit(Activity activity){
        return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, Permission_Phonestate_deencredit);
    }

    public static boolean checkSmsPermission_deencredit(Activity activity){
        return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, Permission_Sms_deencredit);
    }

}
